package scale.GUI;

import java.awt.ComponentOrientation;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;

public abstract class UpArrows extends JPanel{

	public UpArrows(){
		this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
		this.setLayout(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();
		Icon upArrow = new ImageIcon("uparrow.gif");
		JButton b;


		b = new JButton(upArrow);
		c.gridwidth = 1;
		c.gridy = 0;
		c.ipadx = 32;
		b.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				controlAction(1);

			}
		});
		this.add(b,c);

		b = new JButton(upArrow);
		c.gridx = 1;
		this.add(b,c);
		b.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				controlAction(2);

			}
		});

		b = new JButton(upArrow);
		c.gridx = 2;
		this.add(b,c);
		b.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				controlAction(3);

			}
		});

		b = new JButton(upArrow);
		c.gridx = 3;
		this.add(b,c);
		b.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				controlAction(4);

			}
		});

		b = new JButton(upArrow);
		c.gridx = 4;
		this.add(b,c);
		b.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				controlAction(5);

			}
		});
	}
	
	public abstract void controlAction(int i);
}
